<template>
  <div class="top">
    <div class="left">
      <span class="btn" @click="gohome">首页</span>
    </div>
    <div class="conter">
      <div class="title">智慧旅游可视化大数据平台</div>
    </div>
    <div class="right">
      <span class="rbt">统计报告</span>
      <span class="time">当前时间:{{ time }}</span>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { ref, onMounted, onBeforeUnmount } from 'vue'
import moment from 'moment'
const time: any = ref(moment().format('YYYY年MM月DD日 hh:mm:ss'))
const timer = ref(0)
//获取路由对象
const router = useRouter()
const gohome = () => {
  router.push('/home')
}
onMounted(() => {
  timer.value = setInterval(() => {
    time.value = ref(moment().format('YYYY年MM月DD日 hh:mm:ss'))
  }, 1000)
})
onBeforeUnmount(() => {
  clearInterval(timer.value)
})
</script>

<style scoped lang="scss">
.top {
  width: 100vw;
  height: 40px;
  display: flex;
  .left {
    flex: 1;
    background: url(../../../screen/images/dataScreen-header-left-bg.png) no-repeat;
    background-size: cover;
    .btn {
      float: right;
      width: 150px;
      height: 40px;
      background: url(../../images/dataScreen-header-btn-bg-r.png) no-repeat;
      background-size: 100%, 100%;
      text-align: center;
      line-height: 40px;
      color: #29fcff;
      font-size: 20px;
    }
  }
  .conter {
    flex: 2;
    .title {
      width: 100%;
      height: 74px;
      background: url(../../images/dataScreen-header-center-bg.png) no-repeat;
      background-size: 100% 100%;
      text-align: center;
      font-size: 30px;
      color: #29fcff;
      line-height: 74px;
    }
  }
  .right {
    display: flex;
    flex: 1;
    background: url(../../../screen/images/dataScreen-header-left-bg.png) no-repeat;
    background-size: cover;
    justify-content: space-between;
    align-items: center;
    .rbt {
      width: 150px;
      height: 40px;
      background: url(../../images/dataScreen-header-btn-bg-r.png) no-repeat;
      background-size: cover;
      text-align: center;
      color: #29fcff;
      font-size: 20px;
      line-height: 40px;
    }
    .time {
      color: #29fcff;
    }
  }
}
</style>
